home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD School House 10
/
CD School House - Education and Games (10.0) - Wayzata Technology (1995).iso
/
mac
/
DOS
/
MATH
/
ODE25
/
OSCILLAT.ODE
< prev
next >
Wrap
Text File
|
1994-03-03
|
514b
|
28 lines
# OSCILLAT.ODE
# A driven, damped oscillator
#
# Select 5th order Runge-Kutta, fixed stepsize
$m -5
# Solve to time=100
$t 100
position = 1
# Initial values
velocity = 0
time = 0
# Try different amounts of damping
damping = 0.5
# Omega is the natural frequency
omega = 1
# Driving frequency
drivefreq= 1
# Drive amplitude
amplitude= 1
# Differential equations
time' = 1
position' = velocity
velocity' = -omega*position - damping*velocity + amplitude*cos(drivefreq*time)